#ifndef BOOKSMENU_H
#define BOOKSMENU_H

#include <vector>

#include "menu.h"
#include "books.h"

class BooksMenu : public Menu
{
	public:
	enum BookExceptions{FAILID,NOTINTEGER,INVALIDDATE,BORROWED};
	
	BooksMenu(){ std::string str = "Data/books.txt"; Load(_book,book,str);}
	~BooksMenu()
	{
		std::string str("Data/books.txt");Save(book,str);
		
		for (std::vector<Books*>::const_iterator it = book.begin(); it!=book.end(); ++it)
			delete *it;
	}
	
	void Run();
	
	void NewBook(Books*);
	void DeleteBook();
	void Bookslist() const;
	void ModifyBook();
	Books* &SelectBook(const std::string&);
	void WriteOptions() const;
	
	void SearchBook();
	void GetBorrow();
	
	private:
	Books* _book;
	std::vector<Books*> book;
	
	void MenuWrite() const;
	std::string BookIdGen(const std::string&,const std::string&,const int&);
};

#endif